home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11531 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  48 lines

  1. Newsgroups: comp.lang.c
  2. Path: alisa.org!wjjr
  3. From: wjjr@alisa.org (John J. Rushford)
  4. Subject: Re: Help with writing to stdin (UNIX)
  5. X-Newsreader: TIN [version 1.2 PL2]
  6. Organization: My place on the Front Range.
  7. Message-ID: <Dosnnz.FGy@alisa.org>
  8. References: <199603210528.TAA02459@ss20.bnkdp.khabarovsk.su>
  9. Date: Sun, 24 Mar 1996 22:55:11 GMT
  10.  
  11. Igor Kouznetsov (igor@bnkdp.khabarovsk.su) wrote:
  12. : I create a child process (by fork()) and need to insert some input to
  13. : the stdin (sure, stdin is the same for both parent and child 
  14. : processes) in parent, expecting that it will appear in stdin of
  15. : child. 
  16.  
  17. : I tried to do that,foe example, by direct writing to buffer 
  18. : pointed by according fields of stdin FILE structure, but pointer to 
  19. : buffer associated with stdin turns to be NULL, I can't comprehand
  20. : why :-(
  21.  
  22. : I also made some attempts using other methods but they also failed
  23. : for different reasons, so there's no sense to describe that struggle.
  24.  
  25. : A small illustration of the task:
  26. :           ----------       ---------
  27. :          |  Parent  |     | Child   |
  28. :          |  process |     | process |
  29. : -------->|----------|---->|         |
  30. :  stdin   |    ^     |     |         |
  31. :          |    |     |     |         |
  32. :          |   some   |     |         |
  33. :          |   input  |     |         |
  34. :           ---------        ---------
  35. : Does anybody have any idea how to realize it?
  36. : Note: I need NOT a pipe between processes but a way to insert
  37. : something namely to stdin of child process.
  38.  
  39. You need a pipe.  stdin in the parent and child are not the same after the
  40. fork().
  41.  
  42. regards
  43. -- 
  44. John J. Rushford              
  45. Westminster, Colorado___/\_/\_
  46. wjjr@alisa.org (alisa.org is powered by FreeBSD)
  47.  
  48.